\(\int \frac {1}{3+b \sin (e+f x)} \, dx\) [702]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 43 \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\frac {2 \arctan \left (\frac {b+3 \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {9-b^2}}\right )}{\sqrt {9-b^2} f} \]

[Out]

2*arctan((b+a*tan(1/2*f*x+1/2*e))/(a^2-b^2)^(1/2))/f/(a^2-b^2)^(1/2)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.09, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {2739, 632, 210} \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\frac {2 \arctan \left (\frac {a \tan \left (\frac {1}{2} (e+f x)\right )+b}{\sqrt {a^2-b^2}}\right )}{f \sqrt {a^2-b^2}} \]

[In]

Int[(a + b*Sin[e + f*x])^(-1),x]

[Out]

(2*ArcTan[(b + a*Tan[(e + f*x)/2])/Sqrt[a^2 - b^2]])/(Sqrt[a^2 - b^2]*f)

Rule 210

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^(-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])
], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 2739

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[2*(e/d), Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {2 \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{f} \\ & = -\frac {4 \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (e+f x)\right )\right )}{f} \\ & = \frac {2 \arctan \left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.00 \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\frac {2 \arctan \left (\frac {b+3 \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {9-b^2}}\right )}{\sqrt {9-b^2} f} \]

[In]

Integrate[(3 + b*Sin[e + f*x])^(-1),x]

[Out]

(2*ArcTan[(b + 3*Tan[(e + f*x)/2])/Sqrt[9 - b^2]])/(Sqrt[9 - b^2]*f)

Maple [A] (verified)

Time = 0.80 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {2 \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{f \sqrt {a^{2}-b^{2}}}\) \(47\)
default \(\frac {2 \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{f \sqrt {a^{2}-b^{2}}}\) \(47\)
risch \(-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, f}\) \(133\)

[In]

int(1/(a+b*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

2/f/(a^2-b^2)^(1/2)*arctan(1/2*(2*a*tan(1/2*f*x+1/2*e)+2*b)/(a^2-b^2)^(1/2))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 190, normalized size of antiderivative = 4.42 \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\left [-\frac {\sqrt {-a^{2} + b^{2}} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (f x + e\right ) \sin \left (f x + e\right ) + b \cos \left (f x + e\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2}}\right )}{2 \, {\left (a^{2} - b^{2}\right )} f}, -\frac {\arctan \left (-\frac {a \sin \left (f x + e\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (f x + e\right )}\right )}{\sqrt {a^{2} - b^{2}} f}\right ] \]

[In]

integrate(1/(a+b*sin(f*x+e)),x, algorithm="fricas")

[Out]

[-1/2*sqrt(-a^2 + b^2)*log(((2*a^2 - b^2)*cos(f*x + e)^2 - 2*a*b*sin(f*x + e) - a^2 - b^2 + 2*(a*cos(f*x + e)*
sin(f*x + e) + b*cos(f*x + e))*sqrt(-a^2 + b^2))/(b^2*cos(f*x + e)^2 - 2*a*b*sin(f*x + e) - a^2 - b^2))/((a^2
- b^2)*f), -arctan(-(a*sin(f*x + e) + b)/(sqrt(a^2 - b^2)*cos(f*x + e)))/(sqrt(a^2 - b^2)*f)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 144 vs. \(2 (37) = 74\).

Time = 2.17 (sec) , antiderivative size = 144, normalized size of antiderivative = 3.35 \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\begin {cases} \frac {\tilde {\infty } x}{\sin {\left (e \right )}} & \text {for}\: a = 0 \wedge b = 0 \wedge f = 0 \\\frac {\log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} \right )}}{b f} & \text {for}\: a = 0 \\\frac {x}{a + b \sin {\left (e \right )}} & \text {for}\: f = 0 \\\frac {2}{b f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - b f} & \text {for}\: a = - b \\- \frac {2}{b f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} + b f} & \text {for}\: a = b \\\frac {\log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} + \frac {b}{a} - \frac {\sqrt {- a^{2} + b^{2}}}{a} \right )}}{f \sqrt {- a^{2} + b^{2}}} - \frac {\log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} + \frac {b}{a} + \frac {\sqrt {- a^{2} + b^{2}}}{a} \right )}}{f \sqrt {- a^{2} + b^{2}}} & \text {otherwise} \end {cases} \]

[In]

integrate(1/(a+b*sin(f*x+e)),x)

[Out]

Piecewise((zoo*x/sin(e), Eq(a, 0) & Eq(b, 0) & Eq(f, 0)), (log(tan(e/2 + f*x/2))/(b*f), Eq(a, 0)), (x/(a + b*s
in(e)), Eq(f, 0)), (2/(b*f*tan(e/2 + f*x/2) - b*f), Eq(a, -b)), (-2/(b*f*tan(e/2 + f*x/2) + b*f), Eq(a, b)), (
log(tan(e/2 + f*x/2) + b/a - sqrt(-a**2 + b**2)/a)/(f*sqrt(-a**2 + b**2)) - log(tan(e/2 + f*x/2) + b/a + sqrt(
-a**2 + b**2)/a)/(f*sqrt(-a**2 + b**2)), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(1/(a+b*sin(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more de

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.40 \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\frac {2 \, {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2}} f} \]

[In]

integrate(1/(a+b*sin(f*x+e)),x, algorithm="giac")

[Out]

2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(a) + arctan((a*tan(1/2*f*x + 1/2*e) + b)/sqrt(a^2 - b^2)))/(sqrt(a^2 -
 b^2)*f)

Mupad [B] (verification not implemented)

Time = 8.26 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.98 \[ \int \frac {1}{3+b \sin (e+f x)} \, dx=\frac {2\,\mathrm {atan}\left (\frac {b+a\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{f\,\sqrt {a^2-b^2}} \]

[In]

int(1/(a + b*sin(e + f*x)),x)

[Out]

(2*atan((b + a*tan(e/2 + (f*x)/2))/(a^2 - b^2)^(1/2)))/(f*(a^2 - b^2)^(1/2))